package com.example.demo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.demo.pojo.Connection;
import com.example.demo.pojo.Score;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface ConnectionMapper extends BaseMapper<Connection> {

    @Select("select duration,endDate from connection_data where connection_status='off' and (send_user_id=#{id} or receive_user_id=#{id})")
    List<Connection> getDurations(int id);
    @Select("select * from score where user_id=#{id}")
    List<Score> getScores(int id);

    @Select("select * from connection_data where connection_status='on' and (send_user_id=#{id} or receive_user_id=#{id})")
    Connection getConnection(int id);

}
